// 这个模块封装关于用户接口 登录 退出信息..
// 导入仓库
// import store from '@/store'
// 导入axios实例
import instance from '@/utils/request'
// 登录api
export const resLogin = (mobile, code) => {
  // console.log(312321)
  return instance({
    method: 'post',
    url: 'v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}
// 获取个人资料api
export const reqGetProfile = () => {
  console.log(123)
  return instance({
    method: 'get',
    url: 'v1_0/user/profile',
    headers: {
      // Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MTU5NzAyODgsInVzZXJfaWQiOjExMDI0OTA1MjI4Mjk3MTc1MDQsInJlZnJlc2giOmZhbHNlfQ.v3e4ODoPgc4VQUC_id5UjEMmIv4hiyT3Hot55-dYRLY'
      // Authorization: 'Bearer ' + store.state.user.tokenInfo.token
    }
  })
}
// 修改个人资料
export const reqUpdateUserInfo = (obj) => {
  return instance({
    method: 'patch',
    url: 'v1_0/user/profile',
    data: obj
  })
}
// 关注用户
export const reqFollowUser = (target) => {
  return instance({
    method: 'post',
    url: 'v1_0/user/followings',
    data: {
      target
    }

  })
}
// 取关用户
export const reqUnFollowUser = (target) => {
  return instance({
    method: 'delete',
    url: 'v1_0/user/followings/' + target
  })
}
// 刷新token
export const reqGetNewToken = (refreshToken) => {
  return instance({
    method: 'put',
    url: 'v1_0/authorizations',
    headers: {
      Authorization: 'Bearer ' + refreshToken
    }
  })
}
// 获取用户个人信息
export const reqGetUserInfo = () => {
  return instance({
    method: 'get',
    url: '/v1_0/user'
  })
}
// 编辑用户照片
export const reqUpdatePhoto = (obj) => {
  return instance({
    method: 'patch',
    url: 'v1_0/user/photo',
    data: obj
  })
}
